﻿@model Alma.Models.EmptyUser
@{
    ViewContext.Controller.ViewBag.Breadcrumb.Enter("Mon profil");
}
<div class="fullcol">
    <h1>
        Mon profil</h1>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    @if (Model.ID != null && Session["UserId"] != null && Model.ID == (long)Session["UserId"])
    {
        using (Html.BeginForm())
        {
        @Html.ValidationSummary(true)
        <dl>
            <dt>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Email)
                </div>
            </dt>
            <dd>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Email)
                    @Html.ValidationMessageFor(model => model.Email)
                </div>
            </dd>
            <dt>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Firstname)
                </div>
            </dt>
            <dd>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Firstname)
                    @Html.ValidationMessageFor(model => model.Firstname)
                </div>
            </dd>
            <dt>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Name)
                </div>
            </dt>
            <dd>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Name)
                    @Html.ValidationMessageFor(model => model.Name)
                </div>
            </dd>
            <dt>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Address)
                </div>
            </dt>
            <dd>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Address)
                    @Html.ValidationMessageFor(model => model.Address)
                </div>
            </dd>
            <dt>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Zipcode)
                </div>
            </dt>
            <dd>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Zipcode)
                    @Html.ValidationMessageFor(model => model.Zipcode)
                </div>
            </dd>
            <dt>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Town)
                </div>
            </dt>
            <dd>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Town)
                    @Html.ValidationMessageFor(model => model.Town)
                </div>
            </dd>
            <dt>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Country)
                </div>
            </dt>
            <dd>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Country)
                    @Html.ValidationMessageFor(model => model.Country)
                </div>
            </dd>
        </dl>
        <p>
            <input type="submit" value="Modifier" />
        </p>
        }
        if (Model.shopList.Count > 0)
        {
        <h3>
            Mes points de vente</h3>
        <table>
            <tr>
                <th>
                </th><th></th>
                <th>
                    Nom
                </th>
                <th>
                    Email
                </th>
                <th>
                    Telephone
                </th>
                <th>
                    Fax
                </th>
                <th>
                    Adresse
                </th>
            </tr>
            @foreach (var item in Model.shopList)
            {
                <tr><td>
                    @if (item.ImgUrl != null)
                    {
                        <img alt="Product Illustration" class="productImg" src="@Url.Content(item.ImgUrl)" />
                    }
                    else
                    {
                        <img alt="Product Illustration" class="productImg" src="@Url.Content("~/Content/images/unavailable.gif")" />
                    }
                    </td>
                    <td>
                        @Html.ActionLink("Voir", "Show", "Shop", new { id = item.ID }, null) |
                        @Html.ActionLink("Editer", "Edit", "Shop", new { id = item.ID }, null) |
                        @Html.ActionLink("Supprimer", "Delete", "Shop", new { id = item.ID }, null)
                        @*            @Html.ActionLink("Details", "Details", new { id=item.ID }) |*@
                    </td>
                    <td>
                        @item.Name
                    </td>
                    <td>
                        @item.Email
                    </td>
                    <td>
                        @item.Phone
                    </td>
                    <td>
                        @item.Fax
                    </td>
                    <td>
                        @item.Address
                        @item.Zipcode
                        @item.Town
                        @item.Country
                    </td>
                </tr>
            }
        </table>
        }
        @Html.ActionLink("Nouveau magasin", "Create", "Shop");

    }
    else
    {
        @: Vous n'avez pas les permissions nécessaires pour effectuer cette action.
    }

</div>
